package com.lovegu.basic;

import java.util.Scanner;

/**
 * @author 老顾
 * @title: PositiveNegative
 * @projectName java-restudy
 * @email: 1437594522@qq.com
 * @date 2022/9/20 15:27
 */
public class PositiveNegative {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int positiveNumber = 0;//统计正数的个数
        int negativeNumber = 0;//统计负数的个数
        for(;;){ //while(true){
            System.out.println("请输入一个整数：");
            int z = scanner.nextInt();
            if(z>0) {
                positiveNumber++;
            }else if(z<0) {
                negativeNumber++;
            }else {
                break;
            }
        }
        System.out.println("正数的个数为："+ positiveNumber);
        System.out.println("负数的个数为："+ negativeNumber);
    }
}
